const Router = require('koa-router')
// 引入路由模块
const user = require('../controller/user')
const student = require('../controller/student')
const company = require('../controller/company')
const job = require('../controller/job')
const record = require('../controller/record')

// 首页路由
const index = new Router()

// TODO: 用户相关路由
const UserRouter = new Router()
UserRouter.get('/user/:id', user.getUserById)
UserRouter.post('/user/register', user.newUser)
UserRouter.post('/login', user.login)
UserRouter.post('/user/set', user.setUser)
UserRouter.del('/user/:id', user.delUser)
UserRouter.get('/AllUser', user.getAllUser)
UserRouter.post('/delMoreUser', user.delMoreUser)
UserRouter.post('/resetPassword', user.resetPassword)

// TODO: 用户相关路由
const StudentRouter = new Router()
StudentRouter.get('/student/:id', student.getStudentById)
StudentRouter.post('/student/new', student.newStudent)
StudentRouter.post('/student/set', student.setStudent)
StudentRouter.post('/student/all', student.getAllStudent)


// TODO: 企业信息相关路由
const CompanyRouter = new Router()
CompanyRouter.get('/company/:id', company.getCompanyById)
CompanyRouter.post('/company/new', company.newCompany)
CompanyRouter.post('/company/set', company.setCompany)
CompanyRouter.post('/company/all', company.getAllCompany)

// TODO: 岗位信息相关路由
const JobRouter = new Router()
JobRouter.get('/job/:id', job.getJobById)
JobRouter.post('/job/new', job.newJob)
JobRouter.post('/job/set', job.setJob)
JobRouter.post('/job/all', job.getAllJob)


// TODO: 岗位投递信息相关路由
const RecordRouter = new Router()
RecordRouter.get('/record/:id', record.getRecordById)
RecordRouter.post('/record/new', record.newRecord)
RecordRouter.post('/record/set', record.setRecord)
RecordRouter.post('/record/all', record.getAllRecord)


module.exports = {
    index, UserRouter,StudentRouter,CompanyRouter,JobRouter,RecordRouter
}